﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HotelSoft.HotelManagement_BUS;
using HotelSoft.HotelManagement_DTO;

namespace HotelSoft.HotelManagement_GUI
{
    public partial class frmReport_BaoCaomatdo : Form
    {
        BaoCaoDoanhThuTheoLoaiBUS busDT = new BaoCaoDoanhThuTheoLoaiBUS();

        private int iThang, iNam, iQui, iloai;
        private string dngay;

        public string NGAY
        {
            get { return dngay; }
            set { dngay = value; }
        }
        public int LOAI
        {
            get { return iloai; }
            set { iloai = value; }
        }

        public int QUI
        {
            get { return iQui; }
            set { iQui = value; }
        }

        public int NAM
        {
            get { return iNam; }
            set { iNam = value; }
        }

        public int THANG
        {
            get { return iThang; }
            set { iThang = value; }
        }
        public frmReport_BaoCaomatdo()
        {
            InitializeComponent();
        }

       

        private void Viewphong_Load(object sender, EventArgs e)
        {
            try
            {
                if (iloai == 0)
                {
                    DataTable dt = new DataTable();
                    rptReport_Baocaomatdo_NGAY docBaocaoMatdo_ngay = new rptReport_Baocaomatdo_NGAY();
                    string s = Application.StartupPath + "\\rptReport_Baocaomatdo_NGAY.rpt";
                    docBaocaoMatdo_ngay.Load(s);

                    THONGKE_NGAYDTO dto = new THONGKE_NGAYDTO();
                    dto.DATE = NGAY;
                    dt = busDT.BCMD_NGAY(dto);
                    docBaocaoMatdo_ngay.Database.Tables["command"].SetDataSource(dt);
                    Viewphong.ReportSource = docBaocaoMatdo_ngay;
                    docBaocaoMatdo_ngay.SetParameterValue("txtHinhthuc", "NGÀY: " + "(" + dto.DATE + ")");
                }
                if (iloai == 1)
                {
                    DataTable dt = new DataTable();
                    docBaocaoMatdo = new rptReport_Baocaomatdo();
                    string s = Application.StartupPath + "\\rptReport_Baocaomatdo.rpt";
                    docBaocaoMatdo.Load(s);

                    THONGKE_THANGDTO dto = new THONGKE_THANGDTO();
                    dto.THANG = THANG;
                    dto.NAM = NAM;
                    dt = busDT.BCMD_THANG(dto);
                    docBaocaoMatdo.Database.Tables["command"].SetDataSource(dt);
                    Viewphong.ReportSource = docBaocaoMatdo;
                    docBaocaoMatdo.SetParameterValue("txtHinhthuc", "THÁNG "+"("+dto.THANG+"/"+dto.NAM+")"); 
                }

                if (iloai == 2)
                {
                    DataTable dtt = new DataTable();
                    docBaocaoMatdo = new rptReport_Baocaomatdo();
                    string s = Application.StartupPath + "\\rptReport_Baocaomatdo.rpt";
                    docBaocaoMatdo.Load(s);

                    THONGKE_QUIDTO dto = new THONGKE_QUIDTO();
                    dto.QUI = QUI;
                    dto.NAM = NAM;
                    dtt = busDT.BCMD_QUI(dto);
                    docBaocaoMatdo .Database.Tables["command"].SetDataSource(dtt);
                    Viewphong.ReportSource = docBaocaoMatdo;
                    docBaocaoMatdo.SetParameterValue("txtHinhthuc", "QUÍ " + dto.QUI + "/" + dto.NAM); 
                }

                if (iloai == 3)
                {
                    DataTable dt = new DataTable();
                    docBaocaoMatdo = new rptReport_Baocaomatdo();
                    string s = Application.StartupPath + "\\rptReport_Baocaomatdo.rpt";
                    docBaocaoMatdo.Load(s);

                    THONGKE_NAMDTO dto = new THONGKE_NAMDTO();
                    dto.NAM = NAM;
                    dt = busDT.BCMD_NAM(dto);
                    docBaocaoMatdo.Database.Tables["command"].SetDataSource(dt);
                    Viewphong.ReportSource = docBaocaoMatdo;
                    docBaocaoMatdo.SetParameterValue("txtHinhthuc", "NĂM "+dto.NAM); 
                }
            }
            catch 
            {
            }
           
        }

        private void btnClose_Click_1(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
